import Vue from 'vue'
import Cookies from 'js-cookie'
import {store} from './common'
import searchForm from '@/components/searchForm'
import icon from '@/components/icon'
import elDragDialog from '../directive/el-drag-dialog'
import dialog from '@/components/Dialog/index.js'
import imgUpload from '@/components/Upload/imgUploads.js'
import tableImg from '@/components/xForm/tableImg/index.js'
import moment from 'moment'
import {normals} from '@/components/title'

import Element from 'element-ui'

Vue.use(searchForm)
Vue.use(elDragDialog)
Vue.use(dialog)
Vue.use(icon)
Vue.use(normals)
Vue.use(imgUpload)
Vue.use(tableImg)

Vue.use(Element, { size: Cookies.get('size') || 'medium' })
const normalTime = (times, type = 'YYYY-MM-DD HH:mm:ss') => {
    return moment(new Date(times)).format(type)
}
const deepCopy = obj => {
    return JSON.parse(JSON.stringify(obj))
}

Vue.prototype.$moment = moment
Vue.prototype.$normalTime = normalTime
Vue.prototype.$storeId = store
Vue.prototype.$deepCopy = deepCopy
Vue.prototype.$uploadUrl =  process.env.VUE_APP_BASE_API+'/uploadFile'